package com.design.cjm.creational.simplefactory;

/**
 * 简单工厂模式
 */
public class CarFactory {


    /**
     * 创建汽车
     * @param carType
     * @return
     */
    public static Car createInstance(String carType){

        Car car = null;

        switch (carType) {
            case "benZ":
                car = new BenzCar();
                break;
            case "BMW":
                car = new BMWCar();
                break;
            default:
        }

        return car;
    }

}
